<html>

<head>
<?php

include "../includes/constants.php";
include "../includes/functions.php";
include "../includes/profile.php";

?>
<title></title>

<script src="../includes/functions.js"></script>

<link rel="stylesheet" type="text/css" href="spellbook.css">

<?php

if ((!isset($_GET["page"])) || $_GET["page"] == "") {
	$_GET["page"] = 1;
};

$min_page = 1;
$max_page = 25;
$page_num = $_GET["page"] * 2;
$spell_diff = ($_GET["page"] - 1) * 16;

?>

</head>

<body>

<table border="0">
	<tr id="pad_top">
		<td id="pad_left"></td>
		<td></td>
		<td id="pad_num1"><?php echo $page_num - 1;?></td>
		<td></td>
		<td id="pad_middle"></td>
		<td></td>
		<td id="pad_num2"><?php echo $page_num;?></td>
		<td></td>
		<td id="pad_right"><a href="javascript:window.close()"><img height="9" width="9" style="" src="../images/blank.gif"></a></td>
	</tr>
	<tr>
		<td id="pad_left"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 1]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 1]) . "\n";?>
		</td>
		<td id="pad_num1"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 2]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 2]) . "\n";?>
		</td>
		<td id="pad_middle"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 9]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 9]) . "\n";?>
		</td>
		<td id="pad_num2"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 10]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 10]) . "\n";?>
		</td>
		<td id="pad_right"></td>
	</tr>
	<tr>
		<td rowspan="2" id="pad_left">
<?php

if ($_GET["page"] > $min_page) {
	echo "\t\t\t<a href=\"" . $_SERVER["PHP_SELF"] . "?id=" . $_GET["id"] . "&page=" . ($_GET["page"] - 1) . "\"><p align=\"left\"><img height=\"20\" width=\"16\" style=\"\" src=\"../images/blank.gif\"></a>\n";
};

?>
		</td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 3]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 3]) . "\n";?>
		</td>
		<td id="pad_num1"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 4]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 4]) . "\n";?>
		</td>
		<td id="pad_middle"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 11]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 11]) . "\n";?>
		</td>
		<td id="pad_num2"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 12]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 12]) . "\n";?>
		</td>
		<td rowspan="2" id="pad_right">
<?php

if ($_GET["page"] < $max_page) {
	echo "\t\t\t<a href=\"" . $_SERVER["PHP_SELF"] . "?id=" . $_GET["id"] . "&page=" . ($_GET["page"] + 1) . "\"><p align=\"right\"><img height=\"20\" width=\"16\" style=\"\" src=\"../images/blank.gif\"></a>\n";
};

?>
		</td>
	</tr>
	<tr>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 5]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 5]) . "\n";?>
		</td>
		<td id="pad_num1"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 6]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 6]) . "\n";?>
		</td>
		<td id="pad_middle"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 13]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 13]) . "\n";?>
		</td>
		<td id="pad_num2"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 14]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 14]) . "\n";?>
		</td>
	</tr>
	<tr>
		<td id="pad_left"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 7]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 7]) . "\n";?>
		</td>
		<td id="pad_num1"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 8]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 8]) . "\n";?>
		</td>
		<td id="pad_middle"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 15]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 15]) . "\n";?>
		</td>
		<td id="pad_num2"></td>
		<td id="spell">
			<?php echo GetSpellIcon($Profile["spell_book"][$spell_diff + 16]);?><br>
			<?php echo GetSpellName($Profile["spell_book"][$spell_diff + 16]) . "\n";?>
		</td>
		<td id="pad_right"></td>
	</tr>
	<tr id="pad_bottom">
		<td id="pad_left"></td>
		<td></td>
		<td id="pad_num1"></td>
		<td></td>
		<td id="pad_middle"></td>
		<td></td>
		<td id="pad_num2"></td>
		<td></td>
		<td id="pad_right"></td>
	</tr>
</table>

</body>

</html>